part of 'page.dart';

class _AllPhrasalVerbPageTranslation {
  static final delegate = _AllPhrasalVerbPageTranslationDelegate();

  static _AllPhrasalVerbPageTranslation of(BuildContext context) {
    return Localizations.of(context, _AllPhrasalVerbPageTranslation);
  }

  late String _languageCode;

  Future<void> load(Locale locale) async {
    _languageCode = locale.languageCode;
  }

  String _resolve(Map<String, String> translations) {
    return translations[_languageCode]!;
  }

  String get numberTableColumnHeader {
    return _resolve(const {
      'en': '№',
    });
  }

  String get titleTableColumnHeader {
    return _resolve(const {
      'en': 'Title',
    });
  }

  String get rankTableColumnHeader {
    return _resolve(const {
      'en': 'Rank',
    });
  }

  String get translationTableColumnHeader {
    return _resolve(const {
      'en': 'Translation',
    });
  }
}

class _AllPhrasalVerbPageTranslationDelegate extends LocalizationsDelegate<_AllPhrasalVerbPageTranslation> {
  @override
  bool isSupported(Locale locale) => const ['en'].contains(locale.languageCode);

  @override
  bool shouldReload(LocalizationsDelegate<_AllPhrasalVerbPageTranslation> old) => false;

  @override
  Future<_AllPhrasalVerbPageTranslation> load(Locale locale) async {
    final translation = _AllPhrasalVerbPageTranslation();
    await translation.load(locale);
    return translation;
  }
}
